home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / pas_0593.zip / DISKID.PAS < prev    next >
Pascal/Delphi Source File  |  1993-05-30  |  2KB  |  64 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 219 of 292
  3. From : PETER KLAPPROTH                     2:242/56.9           14 May 93  18:27
  4. To   : Jud Mccranie                        1:3645/20.0
  5. Subj : Re^2: diskette Serial Numbe
  6. ────────────────────────────────────────────────────────────────────────────────
  7. Jud Mccranie@1:3645/20.0 wrote 26.04.93
  8. about "Re: diskette Serial Numbe":
  9.  
  10. >  MG>         If anyone happens to know how to find the serial number
  11. >  MG>         of a diskette, please let me know, code is nice :)
  12. >
  13. > It is stored in byte 42, 41, 40, and 39 (counting the first one as
  14. > 0) of ths first sector of the disk.  The code I have for it uses the
  15. > TPro package to read the sector.
  16. >
  17.  
  18. Hi Jud,
  19. annother way to read/write the diskId is the following small peace of
  20. code.}
  21.  
  22. Unit DiskId;
  23. interface
  24. type TInfoBuffer = record
  25.                      InfoLevel : word; {may be 0}
  26.                      Serial    : longInt;
  27.                      VolLabel  : array [0..10] of char;
  28.                      FileSystem: array [0..7] of char;
  29.                    end;
  30.  
  31. function GetSerial(DiskNum: Byte; var I:TInfoBuffer):word;
  32. function SetSerial(DiskNum: Byte; var I:TInfoBuffer):word;
  33.  
  34. implementation
  35.  
  36. function GetSerial(DiskNum : Byte; var I:TInfoBuffer):word; assembler;
  37. asm
  38.   mov ah,69h
  39.   mov al,00h
  40.   mov bl, DiskNum
  41.   push ds
  42.   lds dx,I
  43.   int 21h
  44.   pop ds
  45.   jc @bad
  46.   Xor ax,ax
  47.   @bad:
  48. end;
  49.  
  50. function SetSerial(DiskNum : Byte; var I:TInfoBuffer):word; assembler;
  51. asm
  52.   mov ah,69h
  53.   mov al,01h
  54.   mov bl, DiskNum
  55.   push ds
  56.   lds dx,I
  57.   int 21h
  58.   pop ds
  59.   jc @bad
  60.   xor ax,ax
  61.   @bad:
  62. end;
  63.  
  64. end.